/*  1:   */ package org.jetbrains.jps.model.java.impl;
/*  2:   */ 
/*  3:   */

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.JpsElementReference;
import org.jetbrains.jps.model.JpsModel;
import org.jetbrains.jps.model.ex.JpsCompositeElementBase;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.java.JpsJavaSdkType;
import org.jetbrains.jps.model.java.JpsJavaSdkTypeWrapper;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.JpsTypedLibrary;
import org.jetbrains.jps.model.library.sdk.JpsSdk;
import org.jetbrains.jps.model.library.sdk.JpsSdkReference;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */
/* 16:   */
/* 17:   */
/* 18:   */
/* 19:   */ 
/* 20:   */ public class JpsWrappedJavaSdkReferenceImpl
/* 21:   */   extends JpsCompositeElementBase<JpsWrappedJavaSdkReferenceImpl>
/* 22:   */   implements JpsSdkReference<JpsDummyElement>
/* 23:   */ {
/* 24:37 */   private static final JpsElementChildRoleBase<JpsSdkReference<?>> a = JpsElementChildRoleBase.create("wrapper reference");
/* 25:   */   private final JpsJavaSdkTypeWrapper b;
/* 26:   */   
/* 27:   */   public JpsWrappedJavaSdkReferenceImpl(JpsJavaSdkTypeWrapper paramJpsJavaSdkTypeWrapper, JpsSdkReference<?> paramJpsSdkReference)
/* 28:   */   {
/* 29:41 */     this.b = paramJpsJavaSdkTypeWrapper;
/* 30:42 */     this.myContainer.setChild(a, paramJpsSdkReference);
/* 31:   */   }
/* 32:   */   
/* 33:   */   private JpsWrappedJavaSdkReferenceImpl(JpsWrappedJavaSdkReferenceImpl paramJpsWrappedJavaSdkReferenceImpl)
/* 34:   */   {
/* 35:46 */     super(paramJpsWrappedJavaSdkReferenceImpl);
/* 36:47 */     this.b = paramJpsWrappedJavaSdkReferenceImpl.b;
/* 37:   */   }
/* 38:   */   
/* 39:   */   @NotNull
/* 40:   */   public JpsWrappedJavaSdkReferenceImpl createCopy()
/* 41:   */   {
/* 42:53 */     void tmp8_5 = new JpsWrappedJavaSdkReferenceImpl(this);
/* 43:53 */     if (tmp8_5 == null) {
/* 44:53 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/java/impl/JpsWrappedJavaSdkReferenceImpl", "createCopy" }));
/* 45:   */     }
/* 46:53 */     return tmp8_5;
/* 47:   */   }
/* 48:   */   
/* 49:   */   public String getSdkName()
/* 50:   */   {
/* 51:58 */     JpsTypedLibrary localJpsTypedLibrary = resolve();
/* 52:59 */     return localJpsTypedLibrary != null ? localJpsTypedLibrary.getName() : "<unknown>";
/* 53:   */   }
/* 54:   */   
/* 55:   */   @Nullable
/* 56:   */   public JpsTypedLibrary<JpsSdk<JpsDummyElement>> resolve()
/* 57:   */   {
/* 58:65 */     JpsTypedLibrary localJpsTypedLibrary = (JpsTypedLibrary)((JpsSdkReference)this.myContainer.getChild(a)).resolve();
/* 59:66 */     if (localJpsTypedLibrary == null) {
/* 60:66 */       return null;
/* 61:   */     }
/* 62:67 */     JpsModel localJpsModel = getModel();
/* 63:68 */     if (localJpsModel == null) {
/* 64:68 */       return null;
/* 65:   */     }
/* 66:69 */     String str = this.b.getJavaSdkName(((JpsSdk)localJpsTypedLibrary.getProperties()).getSdkProperties());
/* 67:70 */     if (str == null) {
/* 68:70 */       return null;
/* 69:   */     }
/* 70:72 */     JpsLibrary localJpsLibrary = localJpsModel.getGlobal().getLibraryCollection().findLibrary(str);
/* 71:73 */     return localJpsLibrary != null ? localJpsLibrary.asTyped(JpsJavaSdkType.INSTANCE) : null;
/* 72:   */   }
/* 73:   */   
/* 74:   */   public JpsElementReference<JpsTypedLibrary<JpsSdk<JpsDummyElement>>> asExternal(@NotNull JpsModel paramJpsModel)
/* 75:   */   {
/* 76:78 */     if (paramJpsModel == null) {
/* 77:78 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/java/impl/JpsWrappedJavaSdkReferenceImpl", "asExternal" }));
/* 78:   */     }
/* 79:78 */     paramJpsModel.registerExternalReference(this);
/* 80:79 */     return this;
/* 81:   */   }
/* 82:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.jps.model.java.impl.JpsWrappedJavaSdkReferenceImpl

 * JD-Core Version:    0.7.0.1

 */